var isCityNameClick = false;
$(function(){ 
	$('#cityName').click(function(){
		if(isCityNameClick){
			return;
		}
		isCityNameClick =true;
		var value =$(this).val();
		$('#cityName').combogrid({
			rownumbers:true,
			pagination:true, 
			panelWidth:450,
			width:186,
			idField:'cityID',
			textField:'cityName',
			url:js+'dict/chooseCity.action',
			columns:[[
				{field:'cityCode',title:'城市编号',width:100},
				{field:'cityName',title:'城市名称',width:100}
			]],					
			filter:function(q,row){  
				if(row.cityCode.toUpperCase().indexOf(q.toUpperCase())>=0) return true;
			},
			toolbar:[
			 	{text:'清空',iconCls:'icon-no',	handler:function(){ $('#cityName').combogrid('clear');  $('#cityID').val('');  $('#cityName').val('');}},
			 	'-',
			 	{text:'确定',iconCls:'icon-ok',handler:function(){$('#cityName').combogrid('hidePanel'); }}]
			 ,onHidePanel:function(){
					var cityID = $('#cityName').combogrid('getValue');
					var hidden = $('#cityID').val();
					if(hidden==cityID||cityID==''){
						return;
					}
					$('#cityID').val(cityID);
			    }
		});	
		$('#cityName').combogrid('setText',value);
	})	   
})
